package main

import (
	"fmt"
	"os"
)

func main() {
	dir := "diName" // 假设目录不存在
	info, err := os.Stat(dir)
	//IsExist(err)  // 返回false
	//!IsNotExist(err)  // 返回true

	//文件判断
	fmt.Println("err :", err)								//err : CreateFile diName: The system cannot find the file specified.
	fmt.Println("IsExist :", os.IsExist(err))				//IsExist : false
	fmt.Println("!os.IsNotExist :", !os.IsNotExist(err))	//!os.IsNotExist : false
	fmt.Println("IsNotExist :", os.IsNotExist(err))			//IsNotExist : true

	//输出文件属性
	fmt.Println("name =",info.Name())
	fmt.Println("size =",info.Size())
	fmt.Println("mode =",info.Mode())
	fmt.Println("modtime =",info.ModTime())
	fmt.Println("isDir =",info.IsDir())
	fmt.Println("sys =",info.Sys())


}
